package com.lgcns.andteam2.todaymenu.item;

import com.lgcns.andteam2.todaymenu.Constants;

/**
 * 주간 메뉴에서 1일치의 정보를 나타낸다.
 */
public class WeekDayMenu {
    private String date;
    private String day;
    private String[] gubunCode = { 
            Constants.BREAKFAST_GUBUN_CODE,
            Constants.LUNCH_GUBUN_CODE,
            Constants.DINNER_GUBUN_CODE
    };
    private String[] gubun = {
            Constants.BREAKFAST_GUBUN,
            Constants.LAUNCH_GUBUN,
            Constants.DINNER_GUBUN
    };
    
    private StringBuffer[] menuName = new StringBuffer[]{new StringBuffer(), new StringBuffer(), new StringBuffer()};
    
    /**
     * YYYYMMDD
     * @return
     */
    public String getDate() {
        return date;
    }
    /**
     * YYYYMMDD
     * @param date
     */
    public void setDate(String date) {
        this.date = date;
    }
    /**
     * 요일
     * @return
     */
    public String getDay() {
        return day;
    }
    /**
     * 요일
     * @param date
     */
    public void setDay(String day) {
        this.day = day;
    }
    public String getGubunCode(int index) {
        return gubunCode[index];
    }
    public String getGubun(int index) {
        return gubun[index];
    }
    public String getMenuName(int index) {
        String menu = menuName[index].toString();
        // 맨 마지막이 개행인 경우 잘라낸다.
        if(menu != null && menu.length() > 0 && menu.charAt(menu.length() - 1) == '\n') {
            menu = menu.substring(0, menu.length() - 1);
        }
        return menu;
    }
    public void setMenuName(int index, String menuName) {
        int len = this.menuName[index].length();
        this.menuName[index].delete(0, len -1);
        this.menuName[index].append(menuName);
    }
    public void addMenuName(int index, String menuName) {
        this.menuName[index].append(menuName);
    }
}
